/* $Id: message.js 2273 2006-11-04 07:28:02Z weberliu $ */

var Message = Object();

Message.bottom    = 0;
Message.count     = 0;
Message.elem      = "popMsg";
Message.mvTimer   = null;


Message.show = function()
{
  try
  {
    Message.controlSound('msgBeep');
    document.getElementById(Message.elem).style.visibility="visible"
    document.getElementById(Message.elem).style.display="block"

    Message.bottom    = 0 - parseInt(document.getElementById(Message.elem).offsetHeight);
    Message.mvTimer   = window.setInterval("Message.move()", 10);

    document.getElementById(Message.elem).style.bottom = Message.bottom + "px";
  }
  catch(e){ alert(e); }
}

Message.move = function()
{
  try
  {
    if (Message.bottom == 0)
    {
      window.clearInterval(Message.mvTimer)
      Message.mvTimer = window.setInterval("Message.close()", 10000)
    }

    Message.bottom ++;
    document.getElementById(Message.elem).style.bottom = Message.bottom + "px";
  }
  catch(e){ alert(e); }
}

Message.close = function()
{
  document.getElementById(Message.elem).style.visibility='hidden';
  document.getElementById(Message.elem).style.display='none';
  if (Message.mvTimer) window.clearInterval(Message.mvTimer)
}

Message.controlSound = function(_sndObj) 
{ 
  sndObj = document.getElementById(_sndObj);

  try
  {
  	sndObj.Play();
  }
  catch (e)
  {
  }
}